﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;

namespace WindowsFormsApplication1
{
    public partial class SalesAnalysis : Form
    {
        public SalesAnalysis()
        {
            InitializeComponent();
        }

        private void productBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            this.Validate();
            this.productBindingSource.EndEdit();
            this.tableAdapterManager.UpdateAll(this.seniordesignDataSet);

        }

        private void SalesAnalysis_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'seniordesignDataSet.montlysales' table. You can move, or remove it, as needed.
            this.montlysalesTableAdapter.Fill(this.seniordesignDataSet.montlysales);
            // TODO: This line of code loads data into the 'seniordesignDataSet.product' table. You can move, or remove it, as needed.
            this.productTableAdapter.Fill(this.seniordesignDataSet.product);

        }

        private void comboBoxChartType_SelectedIndexChanged(object sender, EventArgs e)
        {
            int chart_type = this.comboBoxChartType.SelectedIndex;
            chart_type += 1;
            switch (chart_type)
            {
                case 1:
                    salesAnalysisChart.Series[0].ChartType = SeriesChartType.Bar; break;
                case 2:
                    salesAnalysisChart.Series[0].ChartType = SeriesChartType.Column; break;
                case 3:
                    salesAnalysisChart.Series[0].ChartType = SeriesChartType.Line; break;
                case 4:
                    salesAnalysisChart.Series[0].ChartType = SeriesChartType.Pie; break;
                case 5:
                    salesAnalysisChart.Series[0].ChartType = SeriesChartType.Point; break;
                case 6:
                    salesAnalysisChart.Series[0].ChartType = SeriesChartType.Pyramid; break;
                case 7:
                    salesAnalysisChart.Series[0].ChartType = SeriesChartType.Radar; break;
                case 8:
                    salesAnalysisChart.Series[0].ChartType = SeriesChartType.Renko; break;


            }       
        }

        private void checkBoxShowValue_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBoxShowValue.Checked)
            {
                salesAnalysisChart.Series[0].IsValueShownAsLabel = true;
            }
            else
            {
                salesAnalysisChart.Series[0].IsValueShownAsLabel = false;
            }
        }
    }
}
